'use strict';
var passgen = (function () {
	var _private = {
		implementor : 'MD5',
		passwordlength : 12,
		get : function ( key, domain ) {
			var keylen = key.length, c = Crypto[this.implementor]; 
			domain = url.clean(domain);
			if ('undefined' !== typeof c) {
				return (c(c(key) + c(domain)).slice(keylen, (keylen + this.passwordlength)));
			}
			else {
				throw "The hash implementation you tried to use isn't set up properly.";
			}
		}
	}; 	
	return {
		pub : function( args ) {
			if (args.implementor){
				_private.implementor = args.implementor; 
			}
			if (args.length){
				_private.passwordlength = args.length;
			}
			if (args.key && args.domain) {
				return _private.get(args.key, args.domain);
			}
		}
	}
})(); 
